package test;

public class main {
    public static void main(String[] args) {
        //1.使用多线程的同步方式实现卖票(同步代码块,同步方法,Look锁任选其一)
        TicketCounter ticketCounter = new TicketCounter();
        Thread t1 = new Thread(()->{
            while(true){
                ticketCounter.sellTicket();
            }
        },"售票员1");

        Thread t2 = new Thread(()->{
            while(true){
                ticketCounter.sellTicket();
            }
        },"售票员2");
        t1.start();

        t2.start();
    }
}
